﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Modules.guide.ui {
    import flash.display.*;
    import flash.geom.*;
    import Engine.Helpers.*;
    import com.greensock.*;
    import Engine.*;

    public class GuideTile {

        protected var m_width:Number;
        protected var m_height:Number;
        protected var m_position:Vector3;
        protected var m_id:Number;
        protected var m_visible:Boolean;
        protected var m_tileSprite:Sprite;
        private var m_animTimeline:TimelineLite;

        public function GuideTile(_arg1:Vector3, _arg2:Number, _arg3:Number){
            this.m_tileSprite = new Sprite();
            super();
            this.m_position = _arg1;
            this.m_width = _arg2;
            this.m_height = _arg3;
            GlobalEngine.viewport.overlayBase.addChild(this.m_tileSprite);
        }
        public function cleanup():void{
            GlobalEngine.viewport.overlayBase.removeChild(this.m_tileSprite);
            this.m_tileSprite = null;
            if (this.m_animTimeline){
                this.m_animTimeline.kill();
            };
        }
        public function drawGuideTile(_arg1:uint):void{
            this.m_tileSprite.graphics.clear();
            this.m_tileSprite.graphics.lineStyle(2, _arg1);
            this.m_tileSprite.graphics.beginFill(0, 0);
            this.drawTileArea(this.m_tileSprite.graphics, this.m_position, this.m_width, this.m_height);
            this.m_tileSprite.graphics.endFill();
        }
        public function get origin():Vector3{
            return (this.m_position);
        }
        public function drawTileArea(_arg1:Graphics, _arg2:Vector3, _arg3:Number, _arg4:Number):void{
            var _local5:Point = IsoMath.tilePosToPixelPos(_arg2.x, _arg2.y);
            var _local6:Vector2 = IsoMath.getPixelDeltaFromTileDelta(_arg3, 0);
            var _local7:Vector2 = IsoMath.getPixelDeltaFromTileDelta(0, _arg4);
            _arg1.moveTo(_local5.x, _local5.y);
            _arg1.lineTo((_local5.x + _local6.x), (_local5.y + _local6.y));
            _arg1.lineTo(((_local5.x + _local6.x) + _local7.x), ((_local5.y + _local6.y) + _local7.y));
            _arg1.lineTo((_local5.x + _local7.x), (_local5.y + _local7.y));
            _arg1.lineTo(_local5.x, _local5.y);
        }
        public function blinkTile(_arg1:Number, _arg2:int, _arg3:Function=null):void{
            this.m_animTimeline = new TimelineLite({
                onComplete:this.blinkComplete,
                onCompleteParams:[_arg3]
            });
            this.m_animTimeline.append(new TweenLite(this.m_tileSprite, _arg1, {alpha:0}));
            var _local4:int;
            while (_local4 < _arg2) {
                this.m_animTimeline.appendMultiple([new TweenLite(this.m_tileSprite, _arg1, {alpha:1}), new TweenLite(this.m_tileSprite, _arg1, {alpha:0})], 0, TweenAlign.SEQUENCE);
                _local4++;
            };
        }
        private function blinkComplete(_arg1:Function=null):void{
            this.cleanup();
            if (_arg1 != null){
                _arg1();
            };
        }

    }
}//package Modules.guide.ui 
